<?php

/* 用户提现交易 */
class UsercashModel extends BaseModel
{
	var $table  = 'user_cash';
	var $prikey = 'cash_id';
	var $_name  = 'user_cash';

	//一天提现金额次数
	function get_count_by_day($user_id)
	{
		$sTime=strtotime(date("Y-m-d"));
		$eTime=strtotime(date("Y-m-d",strtotime("+1 day")));
		$sql = "SELECT count(cash_id) as num FROM {$this->table} WHERE user_id  = '{$user_id}' and add_time >= '{$sTime}' and add_time < '{$eTime}'";
		$num = $this->db->getOne($sql);
		return $num;
	}
	//一天提现总金额
	function get_sum_by_day($user_id)
	{
		$sTime=strtotime(date("Y-m-d"));
		$eTime=strtotime(date("Y-m-d",strtotime("+1 day")));
		$sql = "SELECT sum(amount) as total FROM {$this->table} WHERE user_id  = '{$user_id}' and add_time >= '{$sTime}' and add_time < '{$eTime}' ";
		$total= $this->db->getOne($sql);
		return $total;
	}

}

?>